package 案例.生产消费;

/**
 * 厨子
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/7/6 下午8:21
 */
public class Cooker implements Runnable {
    private final Food food;

    public Cooker(Food food) {
        this.food = food;
    }

    /**
     * 线程主体方法 ，就绪状态要执行的方法
     */
    public void run() {
        for (int i = 0, len = 20; i < len; i++) {
            if (i % 2 == 0) {
                food.createFood("网红面条");
            } else {
                food.createFood("体宴");
            }
        }
    }

}
